package com.ytplayer.screen {
	import com.greensock.TweenMax;
	import flash.display.Sprite;
	
	/**
	 * ...
	 * @author Jakub Wagner
	 */
	public class Screen extends Sprite implements IResizable {
		
		public function Screen() {
		}
		
		/**
		 * Zobrazí tento Screen.;
		 */
		public function show():void {
			TweenMax.fromTo(this, .3, {autoAlpha: 0, immediateRender: true}, {delay: .3, autoAlpha: 1, onComplete: showComplete});
		}
		
		/**
		 * Shová tento Screen. Automaticky ho odstraní ze scény.
		 */
		public function hide():void {
			TweenMax.fromTo(this, .3, {autoAlpha: 1}, {autoAlpha: 0, onComplete: onHideComplete});
		}
		
		/**
		 * Function to override. V přepsané metodě volejte super.setSize()
		 */
		public function setSize(__width:Number, __height:Number, applyMargins:Boolean = true):void {
		}
		
		private function onHideComplete():void {
			parent.removeChild(this);
			
			hideComplete();
		}
		
		/**
		 * Function to override. Volá se po dokončeném shování screenu.
		 */
		public function hideComplete():void 
		{
			
		}
		
		/**
		 * Function to override. Volá se po dokončeném zobrazení screenu.
		 */
		public function showComplete():void 
		{
			
		}
	
	}

}

